package com.wasion.pwportable.protocol.analyzer.terminal;

import com.wasion.core.util.ConverterXBaseUtil;
import com.wasion.pwportable.protocol.Protocol;
import com.wasion.pwportable.protocol.analyzer.AbstractAnalyzer;

public class APN_USER_PASS_RD_Analyzer extends AbstractAnalyzer {

	@Override
	public void dataAnalysis(String ackBS) {

		String dataType = ackBS.substring(DATATPYESTARTBIT, DATATPYENDBIT);

		if (dataType.equalsIgnoreCase(Protocol.T_USER_PASSWOR_RD)) {
			String data = ackBS.substring(DATABITSTART, DATABITSTART + 64);

			String data1 = data.substring(0, 32);
			String data2 = data.substring(32, 64);

			result.setUserName(ConverterXBaseUtil.decode(data1).trim());
			result.setPassword(ConverterXBaseUtil.decode(data2).trim());
		}
	}
}
